package com.yan.demo;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Locale;

public class Demo1 {
    public static void main(String[] args) {
        String str1 = "askdjbhajksdbhiujasdbhuiasgdiakshndika";
        String str2 = str1.replace("a" , "");
        int count = (str1.length() - str2.length()) / 1;
        System.out.println("count = " + count);

        // 字符串分割数组
        String[] split = str1.split("i");
        System.out.println(Arrays.toString(split));

        // 字符串转字符数组
        String str3 = "                            1+(2*3)";
        char[] chars = str3.toCharArray();
        System.out.println(Arrays.toString(chars));

        // 将字符串转为字节数组
        byte[] bytes = str3.getBytes(StandardCharsets.UTF_8);
        System.out.println(Arrays.toString(bytes));

        // 字符串大小写转变
        String s = str1.toUpperCase(); // 转大写                
        System.out.println(s); // 转小写
        String s1 = s.toLowerCase();
        System.out.println(s1);
        // 忽略字符串前后空格
        System.out.println(str3);
        str3 = str3.trim();
        System.out.println(str3);

    }
}
